begintownscript;

variables;
short bmessage,rctx,rcty,pcs,seated;
string custom_m;

body;

beginstate INIT_STATE;

	pcs = 0;
	seated = 0;
	while(pcs <= 3){
		if(char_ok(pcs) == TRUE){
			set_character_facing(pcs,0);
			if(seated == 0)
				relocate_character(pcs,16,21);
			if(seated == 1)
				relocate_character(pcs,15,22);
			if(seated == 2)
				relocate_character(pcs,18,22);
			if(seated == 3)
				relocate_character(pcs,17,23);
			seated = (seated + 1);
		}

		pcs = (pcs + 1);
	}
	force_view_center(16,28);
	rcty = 27;
	while(rcty >= 16){
		force_view_center(16,rcty);
		force_instant_terrain_redraw();
		pause(1);

		rcty = (rcty - 1);
	}
	pause(4);

	reset_dialog();
	add_dialog_str(0,"Where are we now?  This is obviously an illusion, but what is it supposed to be?",0);
	add_dialog_str(1,"Katothen seems to be utterly dumbfounded.  His jaw is lying slack and his eyes are twitching ever so subtly.",0);
	add_dialog_str(2,"There is a man in gold robes standing on the other side of what looks like a complicated magic circle.  His mouth is bent into a scowl and his eyes are bloodshot.",0);
	add_dialog_str(3,"_You remember now, don't you?  The day you attempted to murder your race's brightest and finest?_",0);
	add_dialog_str(4,"It sounds like The Immortal, but clearly doesn't look like him.  Then again, it IS an illusion.",0);
	add_dialog_choice(0,"Who?  Who was killed?  Where is this?");
	bmessage = run_dialog(1);

	pause(3);
	set_character_facing(7,6);
	force_instant_terrain_redraw();
	pause(5);

	reset_dialog();
	add_dialog_str(0,"_This...  this scene is not for your eyes.  I was going to ensure Rothgard's death to you...  but now, this is personal._",0);
	if(party_size() > 1)
		add_dialog_str(1,"Katothen puts his palms together and the world begins to hum, like it did when we visited Sanctuary.",0);
	if(party_size() == 1)
		add_dialog_str(1,"Katothen puts his palms together and the world begins to hum, like it did when I visited Sanctuary.",0);
	add_dialog_str(2,"_You need some rest.  Your work for today is at an end.  Sleep well._",0);
	add_dialog_str(3,"The world begins to black out as the illusion is dampened by the promise of deep, undisturbed sleep.",0);
	add_dialog_choice(0,"...");
	bmessage = run_dialog(1);

	pause(2);
	set_character_pose(7,1);
	pcs = 0;
	while(pcs <= 3){
		if(char_ok(pcs) == TRUE)
			put_sparkles_on_char(pcs,0,4);

		pcs = (pcs + 1);
	}
	run_animation_sound(10);
	pause(2);

	rctx = 15;
	while(rctx >= 4){
		force_view_center(rctx,16);
		force_instant_terrain_redraw();
		pause(1);

		rctx = (rctx - 1);
	}
	pause(4);

	set_total_visibility(0);
	pcs = 0;
	while(pcs <= 3){
		if(char_ok(pcs) == TRUE)
			set_terrain(char_loc_x(pcs),char_loc_y(pcs),1);

		pcs = (pcs + 1);
	}
	force_view_center(31,0);
	force_instant_terrain_redraw();
	pause(5);

	reset_dialog();
	add_dialog_str(0,"Since then, many things have happened.",0);
	add_dialog_str(1," ",0);
	add_dialog_str(2,"(Move in any direction to continue)",0);
	add_dialog_choice(0,"Few of them any good, either.");
	bmessage = run_dialog(1);

	rctx = 26;
	while(rctx <= 30){
		rcty = 22;
		while(rcty <= 26){
			set_floor(rctx,rcty,161);
			if(get_terrain(rctx,rcty) == 165)
				set_terrain(rctx,rcty,1);

			rcty = (rcty + 1);
		}

		rctx = (rctx + 1);
	}

	march_party(28,24);
	march_party(28,24);
	march_party(28,24);
	march_party(28,24);

break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;
break;

beginstate 10;
	move_to_new_town(13,1,1);
break;
